package dao.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Color entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "color", catalog = "onlinemall")
public class Color implements java.io.Serializable {

	// Fields

	private Short colorId;
	private String color;
	private Set<ShelfCommodityInfo> shelfCommodityInfos = new HashSet<ShelfCommodityInfo>(
			0);
	private Set<PurchaseCommodityInfo> purchaseCommodityInfos = new HashSet<PurchaseCommodityInfo>(
			0);

	// Constructors

	/** default constructor */
	public Color() {
	}

	/** minimal constructor */
	public Color(String color) {
		this.color = color;
	}

	/** full constructor */
	public Color(String color, Set<ShelfCommodityInfo> shelfCommodityInfos,
			Set<PurchaseCommodityInfo> purchaseCommodityInfos) {
		this.color = color;
		this.shelfCommodityInfos = shelfCommodityInfos;
		this.purchaseCommodityInfos = purchaseCommodityInfos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "color_id", unique = true, nullable = false)
	public Short getColorId() {
		return this.colorId;
	}

	public void setColorId(Short colorId) {
		this.colorId = colorId;
	}

	@Column(name = "color", nullable = false, length = 20)
	public String getColor() {
		return this.color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "color")
	public Set<ShelfCommodityInfo> getShelfCommodityInfos() {
		return this.shelfCommodityInfos;
	}

	public void setShelfCommodityInfos(
			Set<ShelfCommodityInfo> shelfCommodityInfos) {
		this.shelfCommodityInfos = shelfCommodityInfos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "color")
	public Set<PurchaseCommodityInfo> getPurchaseCommodityInfos() {
		return this.purchaseCommodityInfos;
	}

	public void setPurchaseCommodityInfos(
			Set<PurchaseCommodityInfo> purchaseCommodityInfos) {
		this.purchaseCommodityInfos = purchaseCommodityInfos;
	}

}